From: Giovanni Campagna Date: Fri, 25 Mar 2011 16:12:38 +0000 (+0100) Subject: NetworkStatus: hide the only connection for wired devices X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8476 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4ebf07c725d72512c466731d2762baab2b88190e;p=gnome-shell.git NetworkStatus: hide the only connection for wired devices For wired devices (actually, ethernet devices), hide the connection list when there is only one connection (either automatic or stored). The device can be operated with the associated switch. --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 0bb38004f..189af8004 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -449,8 +449,10 @@ NMDevice.prototype = { obj.item.destroy(); this._connections.splice(pos, 1); - if (this._connections.length == 0) { + if (this._connections.length <= 1) { // We need to show the automatic connection again + // (or in the case of NMDeviceWired, we want to hide + // the only explicit connection) this._clearSection(); this._createSection(); } @@ -678,6 +680,20 @@ NMDeviceWired.prototype = { return true; }, + _createSection: function() { + NMDevice.prototype._createSection.call(this); + + // if we have only one connection (normal or automatic) + // we hide the connection list, and use the switch to control + // the device + // we can do it here because addConnection and removeConnection + // both call _createSection at some point + if (this._connections.length <= 1) + this.section.actor.hide(); + else + this.section.actor.show(); + }, + _createAutomaticConnection: function() { let connection = new NetworkManager.Connection(); connection._uuid = NetworkManager.utils_uuid_generate();